Method and system for rapidly vectorizing image by gradient meshes based on parameterization

ABSTRACT

The present invention discloses a method for rapidly vectorizing an image by gradient meshes based on parameterization, which comprises the following steps: determining an image region to be vectorized (S 1 ); converting the image region into a mesh representation (S 2 ); mapping the meshes to a planar rectangular region by parameterizing the meshes (S 3 ); and generating a gradient mesh image according to the parameterization result of said meshes (S 4 ). The present invention generates gradient meshes by converting an image region into meshes and by parameterization, so the gradient meshes are obtained completely automatically without the need for the user to give original meshes and moreover, the computation speed is improved significantly since nonlinear optimization is avoided. In addition, the method of the present invention can process image regions containing or not containing holes.

TECHNICAL FIELD

The present invention relates to digital image processing technologyfields, and more particularly, to a method for rapidly vectorizing imageby gradient meshes based on parameterization and a system of the same.

BACKGROUND ART

A vector image, compared with a raster image with the same content as ithas, has the feature of being independent of resolutions, and hasadvantages of being easy to edit and of higher compression ratio, etc.Currently, the study on raster image vectorization is preliminary, onlythat on binary image and engineering image vectorization is mature, andit is still a challenging problem to vectorize a general image. Gradientmeshes, as a way of vectorized representation of an image, can beprovided by software like Corel Draw and Adobe Illustrator. Generally,is obtaining gradient meshes requires a large number of userinteractions. The US patent application of Sun, Jian et al. (whichapplication number is PCT/US2008/062970) proposed a method based onnonlinear optimization. However, the method requires user interactionsto give original gradient meshes with a relatively low speed

CONTENTS OF THE INVENTION

Aiming at the above disadvantages of prior art, the purpose of thepresent invention is to provide a method and system for vectorizing animage by gradient meshes, by which the vectorized representation bygradient meshes of given image regions can be obtained automaticallywithout the need for the user to provide original gradient meshes. Themethod according to the present invention allows simultaneouslyprocessing image regions containing or not containing holes.

In order to solve the above technical problems, the present inventionprovides a method for rapidly vectorizing image by gradient meshes basedon parameterization, comprising the following steps:

S1, determining an image region to be vectorized;

S2, converting the image region into mesh representations;

S3, mapping the meshes to a planar rectangular region by meshparameterization; and

S4, generating a gradient mesh image according to the results of saidmesh parameterization.

Wherein, step S1 may particularly comprise: selecting an image region tobe vectorized by combining user interactions with matting methods.

Wherein, step S2 may particularly comprise:

B1. for each pixel in the selected image region, calculating the weightof each pixel by using the Sobel operator;

B2. distributing the sampling points by error diffusion;

B3. obtaining the connections among the meshes by using the Delaunaytriangulation.

Wherein, step S3 may particularly comprise:

C1. mapping four corners of the meshes to four endpoints of a rectangle;

C2. mapping the boundary of said mesh to the edge of a rectangularregion;

C3. mapping the internal vertexes of the mesh to the rectangular regionby parameterization,

Wherein, step S4 may particularly comprise:

D1. sampling in the rectangular region uniformly, placing a controlvertex of the gradient mesh at each lattice point of the rectangularregion, and determining the coordinate of the control vertex and itsgradient by using mapping relationship between parameters;

D2. determining the color values and color gradients at the controlvertex by using color sampling and interpolation.

Wherein, the number of the sampling points may be 1/10 of the number ofthe pixels in the selected image region.

Wherein, step C2 may particularly comprise: mapping each vertex on theouter boundary of the mesh to the edge of the rectangular region inaccordance with the principle of equal scaling.

Wherein, step C3 may particularly comprise: if the image region does notcontain hole, a parameterization method with minimized stretch is usedfor solving the internal vertexes of the mesh; If the image regioncontains holes, for said internal vertexes of the mesh, aparameterization method based on Slit Map is used to map the inner holesto horizontal slits, and then a re-parameterization method withminimized stretch is used to determine the position of the vertexes.

Wherein, the color gradients may be obtained by interpolating the colorsof adjacent sampling points for three times.

Wherein, step C1 may particularly comprise:

calculating the major component of the image region, and bounding theimage region by a rectangular bounding box in a direction parallel tothe major component. assuming c_(i) as the point closest to the fourcorners of the rectangle from the edge of the image, placing a disk ofradius r at each pixel on the edge of the image, and counting the numberof the pixels within the disk in the image region, recorded as n(ĉ_(i))where c_(i) is the central pixel of the disk, i=1, 2, 3, 4. Finding apixel c _(i) satisfying the following formula to make the pixel c _(i)close to the point which is closest to the four corners:

${\overset{\_}{c}}_{i} = {{\arg \; {\min\limits_{{\hat{c}}_{i}}{{{n\left( {\hat{c}}_{i} \right)} - {\frac{1}{4}\pi \; r^{2}}}}}} + {\lambda {{{\hat{c}}_{i} - c_{i}}}}}$

Here, λ and r are predetermined parameters respectively.

The present invention also provides a system for rapidly vectorizingimage by gradient meshes based on parameterization, comprising:

an image region selecting unit used for determining an image region tobe vectorized;

an image-mesh converting unit used for converting the correspondingimage region into mesh representations;

a parameterization unit used for mapping the meshes to a planarrectangular region by mesh parameterization; and

a gradient mesh generating unit used for generating a gradient meshimage according to the results of said mesh parameterization.

SPECIFIC MODE FOR CARRYING OUT THE INVENTION

Hereinafter, the specific mode for carrying out the invention isdescribed in detail with reference to the accompanying drawings andembodiments. The following embodiments are provided by way of explainingthe invention but not limiting its scope.

FIG. 1 is a flow chart illustrating the method according to theembodiment of the present invention;

FIG. 2 is a schematic diagram illustrating the parameterization processof processing the image region not containing holes according to theembodiment of the present invention;

FIG. 3 is a schematic diagram illustrating the parameterization processof processing the image region with holes therein according to theembodiment of the present invention.

FIG. 1 is a flow chart illustrating the method according to theembodiment of the present invention. As shown in FIG. 1, the method forrapidly vectorizing image by gradient meshes based on parameterizationcomprises:

S1, determining an image region to be vectorized;

S2, converting the corresponding image region into mesh representations,such as a triangular mesh;

S3, mapping the meshes to a planar rectangular region by meshparameterization; and

S4, generating a gradient mesh image according to the results of saidmesh parameterization.

Wherein, step S1 particularly comprises: selecting an image region to bevectorized by combining user interactions with matting methods. Forexample, the user renders the image region to be processed by usinglasso tools, or the user selects a foreground region and a backgroundregion, and determines the exact boundary of the region to be processedby using matting methods like image segmentation. Here, assuming thatthe region to be processed is a connected region and only contains oneboundary.

In this embodiment, step S2 particularly comprises:

B1. for each pixel in the selected image region, calculating the weightof each pixel by using the Sobel operator;

B2. specifying the number of sampling points to be 1/10 of the number ofpixels in the region by the weight calculated previously, and randomlyacquiring the specified number of sampling points by error diffusion;

B3. obtaining the connections among the meshes by triangulation. Forexample, for the point set containing above sampling points and all theboundary points, a constrained Delaunay algorithm is used to obtain theconnections between the points, in order to make them form planartriangular meshes, and the boundary of the image region is used as aconstraint to make the boundary of the generated triangular meshesconsistent with the original region.

In this embodiment, step S3 particularly comprises:

C1. mapping four corners of the mesh to four endpoints of a rectangle;

C2. mapping the boundary of said mesh to the edge of a rectangularregion;

C3. mapping the internal vertexes of the mesh to the rectangular regionby parameterization.

In this embodiment, step S4 particularly comprises:

D1. sampling in the rectangular region evenly, placing a control vertexof the gradient mesh at each lattice point of the rectangular region,and determining the coordinate of the control vertex and its gradient byusing the mapping relationship between parameters;

D2. determining the color values and color gradients at the controlvertex by using color sampling and interpolation.

In this embodiment, the number of the sampling points is 1/10 of thenumber of the pixels in the selected image region.

In this embodiment, step C2 particularly comprises: mapping each vertexon the outer boundary of the mesh to the edge of the rectangular regionin accordance is with the principle of equal scaling.

In this embodiment, step C3 particularly comprises: for the image regioncontaining inner holes (and the corresponding meshes), theparameterization method based on Slit Map is used to map the inner holesto horizontal slits. The parameterization method with minimized stretchis used to determine the position of the internal vertexes of thetriangular mesh.

In this embodiment, the color gradients are obtained by interpolatingthe colors of adjacent sampling points for three times.

In this embodiment, the step of “mapping four corners of the boundary ofthe mesh to four endpoints of a rectangle” is particularly performed by:

calculating the major component of the image region, and bounding theimage region by a rectangular bounding box in a direction parallel tothe major component; assuming c_(i) is the point closest to the fourcorners of the rectangle from the edge of the image, placing a disk ofradius r at each pixel on the edge of the image, and counting the pixelswithin the disk in the image region, recorded as n(ĉ_(i)), where ĉ_(i)is the central pixel of the disk, i=1, 2, 3, 4; finding a pixel c _(i)satisfying the following formula to make the pixel c _(i) close to thepoint which is closest to the four corners, and make its shapeapproximate to that of the corners of the rectangle (the angle isapproximate to 90 degree):

${\overset{\_}{c}}_{i} = {{\arg \; {\min\limits_{{\hat{c}}_{i}}{{{n\left( {\hat{c}}_{i} \right)} - {\frac{1}{4}\pi \; r^{2}}}}}} + {\lambda {{{\hat{c}}_{i} - c_{i}}}}}$

Here, λ and r are predetermined parameters respectively, for example, itcan be set that λ=0.1, r=5.

For all the vertexes in the meshes, they are mapped to the vector f=(x,y, wdc/dx, wdc/dy) in a 8-dimensional space, wherein x, y are thecoordinate of the vertex in the image, c=(r, g, b) is a 3-dimensionalvector with the three components being the red, green and bluecomponents of the color of the pixels at the vertexes respectively, w isa given constant which is used to balance the fitting error and the meshregularity, and generally may be set as 300. The distance between twoadjacent vertexes is defined as ∥f1−f2∥2. f1 and f2 are vectorsrepresenting mapping two certain vertexes in the mesh to a 8-dimensionalspace, respectively. The said metric (distance ∥f1−f2∥2) is used insteps C2 and C3 to replace general Euclidean metric in order to ensurethat the results of parameterization can reflect the degree ofdifficulties for local region fitting. The image regions which are hardto fit will take up larger parameterization areas, which makes theseregions automatically obtain relatively compact control meshes aftersampling.

FIG. 2 is a schematic diagram illustrating the parameterization processof processing the image region not containing holes according to theembodiment of the present invention. As shown in FIG. 2, the corner ofthe mesh c _(i) (i=1, 2, 3, 4) calculated above is mapped to fourendpoints c _(i)′ (i=1, 2, 3, 4) of the planar rectangular region; thelength of the corresponding boundary of the mesh is l_(i) (i=1, 2, 3, 4)respectively, and the length of the edge of the mapped rectangularregion is s_(x)=(l₂+l₄)/2, s_(y)=(l₁+l₃)/2 respectively, and each vertexon the boundary of the mesh is mapped to the edge of the rectangularregion in accordance with the principle of equal scaling; determiningthe position of the internal vertexes of the mesh by using theparameterization method with minimized stretch. In the abovecalculation, all the used distances (metrics) are Euclidean distances inthe 8-dimensional space as defined herein. When mapping the internalvertexes of the mesh, the position of each internal vertex, aftermapping is optimized, with respect to the Euclidean metrics in the given8-dimensional space, which makes the whole stretch before and aftermapping minimized.

FIG. 3 is a schematic diagram illustrating the parameterization based onSlit Map. For the image region containing inner holes (see the left-handfigure), c ₁ c ₂ and c ₃ c ₄ are re-sampled to be containing the samenumber of sampling points, and pasted to form a topological cylindercontaining holes according to the point-to-point correspondence, andmapped into the rectangular region as shown in the right-hand by usingSlit Map parameterization method, wherein the inner holes are mapped tohorizontal slits. Based on this, in the same case as that where no holeis contained, the positions of the internal vertexes are determined byusing the parameterization method based on minimized stretch.

The present invention also provides a system for rapidly vectorizingimage by gradient meshes based on parameterization, which conducts imagevectorization by using above method and comprises:

an image region selecting unit used for determining the image region tobe vectorized;

an image-mesh converting unit used for converting the correspondingimage region into mesh representations;

a parameterization unit used for mapping the meshes to a planarrectangular region by mesh parameterization; and

a gradient mesh generating unit used for generating a gradient meshimage according to the results of the mesh parameterization.

The embodiments of the present invention generate gradient meshes byconverting an image region into meshes in combination withparameterization, and the experimental results show that, in the methodaccording to the embodiments of the present invention, the gradientmeshes are obtained completely automatically without the need for theuser to provide original meshes; moreover, the computation speed isimproved significantly since nonlinear optimization is avoided.

The above embodiments are only preferred ones, and hence it should beindicated that those ordinary skilled in the art may also conductvarious modifications and variations without departing from technicalprinciple of the present invention, which shall also be regarded as theprotection scope of the present invention.

INDUSTRIAL APPLICABILITY

The technical solutions of the present invention have the followingadvantages: it generates gradient meshes by converting an image regioninto meshes in combination with parameterization, so the gradient meshesare obtained completely automatically without the need for the user toprovide original meshes; moreover, the computation speed is improvedsignificantly since nonlinear optimization is avoided. In addition, themethod according to the present invention can process image regionscontaining or not containing holes.

1-11. (canceled)
 12. A method for rapidly vectorizing image by gradient meshes based on parameterization, comprising the steps of: S1 determining an image region to be vectorized; S2 converting said image region into mesh representations; S3 mapping the meshes to a planar rectangular region by mesh parameterization; and S4 generating a gradient mesh image according to the results of said mesh parameterization.
 13. The method for rapidly vectorizing image by gradient meshes based on parameterization of claim 12, wherein said step S2 comprises: B1 for each pixel in said image region, calculating the weight of each pixel by using the Sobel operator; B2 distributing the sampling points by using error diffusion; B3 obtaining the connections among the meshes by using the Delaunay triangulation.
 14. The method for rapidly vectorizing image by gradient meshes based on parameterization of claim 12, wherein said step S3 comprises: C1 mapping four corners of the mesh to four endpoints of the rectangle; C2 mapping the boundaries of said mesh to the edges of the rectangular region; C3 mapping the internal vertexes of the mesh into the rectangular region by parameterization.
 15. The method for rapidly vectorizing image by gradient meshes based on parameterization of claim 12, wherein said step S4 comprises: D1 sampling in the rectangular region evenly, placing a control vertex of the gradient mesh at each lattice point of the rectangular region, and determining the coordinate of the control vertex and its gradient by using the mapping relationship between parameters; D2 determining the color values and color gradients at said control vertex by using color sampling and interpolation.
 16. The method for rapidly vectorizing image by gradient meshes based on parameterization of claim 13, wherein the number of said sampling points is 1/10 of the number of the pixels in the selected image region.
 17. The method for rapidly vectorizing image by gradient meshes based on parameterization of claim 14, wherein said step C1 comprises: calculating the major component of said image region (as described in step S2), and bounding said image region by using a rectangular bounding box in a direction parallel to the major component; wherein, assuming c_(i), in the edges of the image, is the point closest to the four corners of the rectangle; placing a disk of radius r at each pixel on the edges of the image, and counting the pixels within the disk in the image region, denoted as n(ĉ_(i)), where ĉ_(i) is the central pixel of the disk, i=1, 2, 3, 4; finding a pixel c _(i) satisfying the following formula to make the pixel c _(i) close to the point which is closest to the four corners: ${\overset{\_}{c}}_{i} = {{\arg \; {\min\limits_{{\hat{c}}_{i}}{{{n\left( {\hat{c}}_{i} \right)} - {\frac{1}{4}\pi \; r^{2}}}}}} + {\lambda {{{\hat{c}}_{i} - c_{i}}}}}$ wherein, λ and r are predetermined parameters respectively.
 18. The method for rapidly vectorizing image by gradient meshes based on parameterization of claim 14, wherein said step C2 comprises: mapping each vertex on the outer boundaries of the mesh to the edges of the rectangular region in accordance with the principle of equal scaling.
 19. The method for rapidly vectorizing image by gradient meshes based on parameterization of claim 14, wherein said step C3 comprises: if the image region contains no hole, a parameterization method with minimized stretch is used for determining said internal vertexes of the mesh.
 20. The method for rapidly vectorizing image by gradient meshes based on parameterization of claim 14, wherein said step C3 comprises: if the image region contains holes, for said internal vertexes of the mesh, a parameterization method based on Slit Map is used to map the inner holes to horizontal slits, and then a re-parameterization method with minimized stretch is used to determine the position of the vertexes.
 21. The method for rapidly vectorizing image by gradient meshes based on parameterization of claim 15, wherein said color gradients are obtained by interpolating the colors of adjacent sampling points for three times.
 22. A system for rapidly vectorizing image by gradient meshes based on parameterization, which comprises: an image region selecting unit for determining an image region to be vectorized; an image-mesh converting unit for converting said image region into mesh representations; a parameterization unit for mapping the meshes to a planar rectangular region by mesh parameterization; and a gradient mesh generating unit for generating a gradient mesh image according to the results of said mesh parameterization. 